Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop _emerge/getloadavg.py #1383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Flowdalic
Copy link
Member

@Flowdalic Flowdalic commented Sep 21, 2024

CC @zmedico You added the getloadavg() wrapper to portage with 8607a39dc9d9. However, the commit message lacks a rationale why such a wrapper became necessary. This PR assumes that the reasons for the wrapper are now no longer existent. Could you please clarify if this is true? Otherwise we should consider adding a code comment to _emerge/getloadavg.py explaining the reason for the wrapper.

@Flowdalic Flowdalic requested a review from zmedico September 21, 2024 12:11
@zmedico
Copy link
Member

zmedico commented Sep 26, 2024 via email

@grobian
Copy link
Member

grobian commented Sep 27, 2024

Hi @zmedico os.getloadavg() returns data everywhere I tried. Should it be unavailable, I think we should just ignore it, and disable or bark or something when load average limits are used. It's not like loadaverage means the same on every platform anyway.

As for keeping it in Prefix: I'd say not. /proc is only available on Linux this way AFAICT, so it's hardly useful on other platforms.

@chewi
Copy link
Member

chewi commented Sep 27, 2024

Sounds good to me, although I don't do much with alternative libcs.

@Flowdalic Flowdalic changed the title RFC: Drop _emerge/getloadavg.py Drop _emerge/getloadavg.py Sep 27, 2024
@thesamesam
Copy link
Member

On reflection, please update the commit message to..

  1. include a summary of Drop _emerge/getloadavg.py #1383 (comment) (and perhaps a link),
  2. describe why we're ignoring it if it fails (because we know uclibc failed in the past and we don't want to fail on such cases, just silently chug on)

Portage's custom getloadavg.py wrapper was added with
8607a39 ("If necessary, use /proc/loadavg to emulate
os.getloadavg()."). All platforms we care about provide
os.getloadavg() now, so this can be dropped.

Zac did a nice analysis of the historical background in

gentoo#1383 (comment)

to summarize: python on uclibc did not had os.getloadavg() in the
past, but uclibc (and uclibc-ng) where retired in gentoo [1].

1: https://www.gentoo.org/support/news-items/2021-08-18-uclibc-ng-retirement.html
Signed-off-by: Florian Schmaus <[email protected]>
@Flowdalic
Copy link
Member Author

I've updated the commit message

2. describe why we're ignoring it if it fails

this behavior would change with this PR applied. In the past, we simply ignored a missing os.getloadavg() and tried some fallback. After this PR, portage would fail if there is no os.getloadavg() provided by Python's runtime library.

So we where ignoring "getloadavg() failures" in the past, but after this PR, we would fail.

@thesamesam
Copy link
Member

I'd kind of prefer it if we caught it not existing at all (not just OSError) but if others are OK with failing hard, I guess it's OK with me.

@Flowdalic
Copy link
Member Author

I'd kind of prefer it if we caught it not existing at all (not just OSError) but if others are OK with failing hard, I guess it's OK with me.

I have no strong opinion. I am just always happy if old cruft is remove from a codebase. It seems like we do not need this any more, especially with uclibc gone, but I guess the only way to find out for sure is to give it a shot.

@thesamesam
Copy link
Member

The issue is more with ports to new platforms IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants